package com.anjubao.parking.municipal.parkinglot.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhuchunfeng
 * @date 2019/7/1 13:40
 */
@Getter
@AllArgsConstructor
public enum RuleTypeEnum {

    UNIFY(0, "统一收费"),
    SECTION(1, "分段收费");

    private Integer code;

    private String desc;

    public static RuleTypeEnum getByCode(Integer code) {
        for (RuleTypeEnum e : RuleTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static Boolean exist(Integer code) {
        for (RuleTypeEnum e : RuleTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}
